package ace.oauth2.provider.common.properties;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections.SetUtils;
import org.springframework.security.core.GrantedAuthority;

import java.util.*;

/**
 * @author Caspar
 * @contract 279397942@qq.com
 * @create 2020/1/3 15:21
 * @description oauth2 client config property
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OAuth2ClientProperty {
    private String clientId;
    private String clientSecret;
    private Set<String> scope = Collections.emptySet();
    private Set<String> resourceIds = Collections.emptySet();
    private Set<String> authorizedGrantTypes = new HashSet<>() {{
        add("refresh_token");
        add("client_credentials");
        add("password");
        add("authorization_code");
    }};
    private Set<String> registeredRedirectUris = Collections.emptySet();
    private Set<String> autoApproveScopes = Collections.emptySet();
    private List<GrantedAuthority> authorities = Collections.emptyList();
    private Integer accessTokenValiditySeconds = 7200;
    private Integer refreshTokenValiditySeconds = 604800;
    private Map<String, Object> additionalInformation = new LinkedHashMap<String, Object>();
}
